package com.jblog.infrastructure.dto;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import com.google.gson.annotations.SerializedName;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "article")
@XmlType(propOrder = { "id", "title", "content" })
public class ArticleDTO {

	@XmlElement
	@SerializedName("artileId")
	private long id;

	@XmlElement
	@SerializedName("articleTitle")
	private String title;

	@XmlElement
	@SerializedName("articleContent")
	private String content;

	public long getArticleId() {
		return id;
	}

	public void setArtileId(long artileId) {
		this.id = artileId;
	}

	public String getArticleTitle() {
		return title;
	}

	public void setArticleTitle(String title) {
		this.title = title;
	}

	public String getArticleContent() {
		return content;
	}

	public void setArticleContent(String articlecontent) {
		this.content = articlecontent;
	}

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((content == null) ? 0 : content.hashCode());
        result = prime * result + (int) (id ^ (id >>> 32));
        result = prime * result + ((title == null) ? 0 : title.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        ArticleDTO other = (ArticleDTO) obj;
        if (content == null) {
            if (other.content != null)
                return false;
        } else if (!content.equals(other.content))
            return false;
        if (id != other.id)
            return false;
        if (title == null) {
            if (other.title != null)
                return false;
        } else if (!title.equals(other.title))
            return false;
        return true;
    }

}
